#include <cubefs/core/page_mgr.hpp>
#include <cubefs/core/btree/btree.hpp>
#include <cubefs/core/tools/types/list_printer.hpp>

#include <cubefs/core/models/root/factory.hpp>
#include <cubefs/core/models/kvmap/factory.hpp>


#include <iostream>
#include <typeinfo>
#include <stdlib.h>

#include <cxxabi.h>

using namespace std;
using namespace abi;

using namespace cubefs;
using namespace cubefs::tools;

struct BTreeBase{};

struct BTreeName {
    static const Int Code = 1;
};

typedef BTreeName ControllerName;
typedef RootProfile Profile;

int main(int argc, char** argv) {

    typedef TypeContainer<RootProfile>                                          Container;
    cout<<Container::Init()<<endl;

    Container cont;

    typedef Container::Models<KVMap>::Type                                      RootModel;
    typedef RootModel::NodeBase                                                 NodeBase;
    typedef RootModel::Types::Pages                                             Dispatchers;
    
    typedef Container::Types::PageManagerType                                   PageManager;

    typedef RootModel::Iterator                                                 Iterator;


    //PageManager mgr;

    //TypePrinterTool<RootModel::Node2RootMap>::Dump();
    cout<<"======================="<<endl;
    cout<<"======================="<<endl;

    RootModel rm(cont, 0);

    RootModel::Iterator i = rm.EmptyIterator();

    for (Int c = 0; c < 1000; c++) rm.Insert(i, c, c);

    Iterator ii = rm.FindLE(100, true);

    cont.dump("file.db");

    rm.Remove(i);

    return 0;
}


